﻿@model CmsMvcPartialAdministrationModel

@{
    ResFile = "cms_Pages";
}

<fieldset class="b-form">
    <ol class="b-form__rows ul-reset g-clear">
        <li class="b-form__row g-clear">
            @if (Model.ModuleId.HasValue)
            {            
                <input type="hidden" name="@Html.GetClientNameForAdminViewElement(Model.PageControlId, "ModuleId")" value="@Model.ModuleId" />
                <p>@Model.ModuleDescription</p>
            }
            else
            {
            	<label>@_("Partial view name"):</label><text>&nbsp;</text>
                if (!string.IsNullOrWhiteSpace(Model.PartialAdministrationViewName))
                {
            		@Model.PartialViewName
		        <input type="hidden" name="@Html.GetClientNameForAdminViewElement(Model.PageControlId, "PartialViewName")" value="@Model.PartialViewName" />
                }
                else
                { 
		        <input class="text" name="@Html.GetClientNameForAdminViewElement(Model.PageControlId, "PartialViewName")" value="@Model.PartialViewName" />
                }
            }
        </li>
        <li class="b-form__row g-clear">
        @if (!string.IsNullOrWhiteSpace(Model.PartialAdministrationViewName))
        {        
            <input type="hidden" name="@Html.GetClientNameForAdminViewElement(Model.PageControlId, "PartialModelType")" value="@Model.PartialModelType" />            
            <div>
                @Html.Partial(Model.PartialAdministrationViewName, new { PageControlId = Model.PageControlId, Model = Model.PartialViewModel }.ToExpando())
            </div>        
        }
        else if (!string.IsNullOrEmpty(Model.PartialModelType))
        {
            <input type="hidden" name="@Html.GetClientNameForAdminViewElement(Model.PageControlId, "PartialModelType")" value="@Model.PartialModelType" />
            <div>
                @Html.Partial("DefaultPageControlModelView", Model.GetPartialModelTypeParameters())
            </div>
        }
        else
        {
            <div>@_("This module does not have configurable parameters")</div>
        }
        </li>
    </ol>
</fieldset>